package xaj.xc.ast;

import java.util.ArrayList;
import java.util.List;

import polyglot.ast.Node;
import polyglot.ext.jl.ast.Node_c;
import polyglot.util.Position;
import polyglot.visit.NodeVisitor;

public class ListNode_c extends Node_c implements ListNode {

	private List list;
	
	public ListNode_c(Position pos, List elements) {
		super(pos);
		list = elements;
	}
	
	public ListNode_c(Position pos) {
		super(pos);
		list = new ArrayList();
	}

	public List getElements() {
		return list;
	}
	
	public Node visitChildren(NodeVisitor v) {
		List list = visitList(getElements(), v);
		return reconstruct(list);
	}

	protected ListNode_c reconstruct(List l) {
		if(this.list != l) {
			ListNode_c list = (ListNode_c) copy();
			list.list = l;
			return list;
		} else
			return this;
		
	}
}
